import 'package:enterprise_v6_app/app/core/env/env.dart';
import 'package:enterprise_v6_app/app/core/http/http.dart';
import 'package:enterprise_v6_app/app/core/utils/interface.dart';
import 'package:enterprise_v6_app/app/data/entities/auth/api_urls_entity.dart';
import 'package:enterprise_v6_app/app/data/entities/auth/app_update_entity.dart';
import 'package:enterprise_v6_app/app/data/entities/auth/login_entity.dart';


abstract class AuthApis {
  /// @return {返回值说明}
  /// @description 登录成功, 返回登录Token,
  static HttpRequest<LoginEntity> login({
    required String username,
    required String password,
  }) {
    return HttpUtil().generatePostRequest(
      Interface.loginUrl,
      data: {
        'username': username,
        'password': password,
        // 'type': 2,
        'grant_type': 'password'
      },
    );
  }

  /// 获取业务接口地址
  /// @description 返回业务接口,
  static HttpRequest<ApiUrlsEntity> getUrl() {
    return HttpUtil().generateGetRequest(Interface.getAkyCompAppApiConfig,
        queryParameters: {'serverType': DartDefines.appInstallChannel.name});
  }

  /// app更新接口
  /// @description 返回app更新接口
  /// @param [type] 1:园区端 2:企业端
  /// @param [serverType] 服务类型
  static HttpRequest<AppUpdateEntity> appUpdate() {
    return HttpUtil().generateGetRequest(Interface.appUpdateUrl,queryParameters: {
      'type': 2,
      'serverType': 'meifeng'
    });
  }

}
